<HTML>
<HEAD>
<TITLE>Cartilla Farmacias - ESSA Salud</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1250">
<!-- ImageReady Preload Script (index.psd) -->
<SCRIPT TYPE="text/javascript">
<!--

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		about_us_over = newImage("images/about-us-over.gif");
		services_over = newImage("images/services-over.gif");
		our_stuff_over = newImage("images/our-stuff-over.gif");
		volunteers_over = newImage("images/volunteers-over.gif");
		preloadFlag = true;
	}
}

// -->
</SCRIPT>
<!-- End Preload Script -->
<style type="text/css">
<!--
.Estilo1 {
	font-size: 18px;
	font-weight: bold;
}
-->
</style>
</HEAD>
<link href="css/styles.css" rel="stylesheet" type="text/css">
<center>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 ONLOAD="preloadImages();">
<!-- ImageReady Slices (index.psd) -->
<table width=789 border=0 cellpadding=0 cellspacing=0 class="frame">
  <tr>
    <td colspan=2 rowspan=4><img src="images/m1.gif" width=45 height=92 alt=""></td>
    <td colspan=9><img src="images/m2.gif" width=223 height=14 alt=""></td>
    <td colspan=9 rowspan=3><img src="images/m3.gif" width=305 height=68 alt=""></td>
    <td colspan=12 rowspan=2><img src="images/ic1.gif" width=215 height=34 alt=""></td>
    <td width="10"></td>
  </tr>
  <tr>
    <td colspan=9 rowspan=3><img src="images/title.gif" width=223 height=78 alt=""></td>
    <td><img src="images/spacer.gif" width=1 height=20 alt=""></td>
  </tr>
  <tr>
    <td colspan=2><img src="images/ic2.gif" width=19 height=34 alt=""></td>
    <td height=34 colspan=5 align="left" valign="top" background="images/b_ic1.gif"><a href="index.html" class="a">Inicio</a></td>
    <td width=52 height=34 align="left" valign="top" background="images/b_ic2.gif" ><a href="#" class="a">Ayuda</a></td>
    <td height=34 colspan=4 align="left" valign="top" background="images/b_ic3.gif" ><a href="#" class="a">Contactos</a></td>
    <td></td>
  </tr>
  <tr>
    <td width="124" rowspan=2><a href="about.html"
				> <img name="about_us" src="images/about-us.gif" width=124 height=40 border=0 alt="about us"></a></td>
    <td colspan=7 rowspan=2><a href="planes.html"
				> <img name="services" src="images/services.gif" width=121 height=40 border=0 alt="services"></a></td>
    <td colspan=6 rowspan=2><a href="formularios.html"
				> <img name="our_stuff" src="images/our-stuff.gif" width=121 height=40 border=0 alt="our stuff"></a></td>
    <td colspan=5 rowspan=2><a href="contactenos.php"
				> <img name="volunteers" src="images/volunteers.gif" width=123 height=40 border=0 alt="volunteers"></a></td>
    <td colspan=2 rowspan=2><img src="images/m4.gif" width=31 height=40 alt=""></td>
    <td><img src="images/spacer.gif" width=1 height=24 alt=""></td>
  </tr>
  <tr>
    <td colspan=11><img src="images/m5.gif" width=255 height=16 alt=""></td>
    <td><img src="images/spacer.gif" width=1 height=16 alt=""></td>
  </tr>
  <tr>
    <td colspan=32 rowspan=7><img src="images/cabecera.gif" width="775" height="294"></td>
    <td><img src="images/spacer.gif" width=1 height=118 alt=""></td>
  </tr>
  <tr>
    <td><img src="images/spacer.gif" width=1 height=19 alt=""></td>
  </tr>
  <tr>
    <td><img src="images/spacer.gif" width=1 height=39 alt=""></td>
  </tr>
  <tr>
    <td height="50"><img src="images/spacer.gif" width=1 height=50 alt=""></td>
  </tr>
  <tr>
    <td height="17"><img src="images/spacer.gif" width=1 height=17 alt=""></td>
  </tr>
  <tr>
    <td height="21"><img src="images/spacer.gif" width=1 height=21 alt=""></td>
  </tr>
  <tr>
    <td><img src="images/spacer.gif" width=1 height=30 alt=""></td>
  </tr>
  <tr>
    <td width="29" height="2"><img src="images/spacer.gif" width=27 height=1 alt=""></td>
    <td width="16"><img src="images/spacer.gif" width=15 height=1 alt=""></td>
    <td width="4"><img src="images/spacer.gif" width=4 height=1 alt=""></td>
    <td width="142"><img src="images/spacer.gif" width=136 height=1 alt=""></td>
    <td width="12"><img src="images/spacer.gif" width=11 height=1 alt=""></td>
    <td width="16"><img src="images/spacer.gif" width=15 height=1 alt=""></td>
    <td width="1"><img src="images/spacer.gif" width=1 height=1 alt=""></td>
    <td width="15"><img src="images/spacer.gif" width=14 height=1 alt=""></td>
    <td width="18"><img src="images/spacer.gif" width=17 height=1 alt=""></td>
    <td width="3"><img src="images/spacer.gif" width=3 height=1 alt=""></td>
    <td width="12"><img src="images/spacer.gif" width=12 height=1 alt=""></td>
    <td><img src="images/spacer.gif" width=124 height=1 alt=""></td>
    <td width="11"><img src="images/spacer.gif" width=11 height=1 alt=""></td>
    <td width="3"><img src="images/spacer.gif" width=3 height=1 alt=""></td>
    <td width="16"><img src="images/spacer.gif" width=16 height=1 alt=""></td>
    <td width="16"><img src="images/spacer.gif" width=16 height=1 alt=""></td>
    <td width="32"><img src="images/spacer.gif" width=32 height=1 alt=""></td>
    <td width="20"><img src="images/spacer.gif" width=20 height=1 alt=""></td>
    <td width="23"><img src="images/spacer.gif" width=23 height=1 alt=""></td>
    <td width="60"><img src="images/spacer.gif" width=60 height=1 alt=""></td>
    <td width="13"><img src="images/spacer.gif" width=13 height=1 alt=""></td>
    <td width="6"><img src="images/spacer.gif" width=6 height=1 alt=""></td>
    <td width="6"><img src="images/spacer.gif" width=6 height=1 alt=""></td>
    <td width="9"><img src="images/spacer.gif" width=9 height=1 alt=""></td>
    <td width="27"><img src="images/spacer.gif" width=27 height=1 alt=""></td>
    <td width="10"><img src="images/spacer.gif" width=10 height=1 alt=""></td>
    <td width="5"><img src="images/spacer.gif" width=5 height=1 alt=""></td>
    <td><img src="images/spacer.gif" width=52 height=1 alt=""></td>
    <td width="44"><img src="images/spacer.gif" width=44 height=1 alt=""></td>
    <td width="12"><img src="images/spacer.gif" width=12 height=1 alt=""></td>
    <td width="4"><img src="images/spacer.gif" width=4 height=1 alt=""></td>
    <td width="27"><img src="images/spacer.gif" width=27 height=1 alt=""></td>
    <td></td>
  </tr>
</table>
<form name="form1" method="post" action="">
  <label><span class="Estilo1">Cartilla Farmacias</span><br>
  
<?php
include ("class/class.webservice.php");

$webservice = new WebService();

$localidades = $webservice->farmaciasListarLocalidades();

//Generamos la lista de farmacias

if (!$_POST["filtrar"])
{
	echo "<form name='form1' method='post' action='cfarmacias.php'>
			<label>Localidad: 
				<select name='localidadid' id='localidadid'>
					<option value='Todas'>Todas</option>";					
					foreach ($localidades as $row)
					{
						printf('<option value=%s>%s</option>', str_replace(' ','-',$row['Localidad']), $row['Localidad']);
					}					
	echo '</label>   <input type="submit" name="filtrar" id="filtrar" value="Filtrar"></form><br>';
		
	$listafarmacias = $webservice->farmaciaListarFarmaciasxLocalidad("Todas");
	
	echo '<p><table  border="1"><tr><td>Nombre</td><td>Direccion</td><td>Telefono</td><td>Localidad</td></tr>';
	
	foreach ($listafarmacias as $row)
	{
		printf('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', 
			ucwords($row['Nombre']), 
			ucwords($row['Direccion']), 
			ucwords($row["Telefono"]),
			ucwords($row["Localidad"]));
	}
	echo '</table></p>';
}
else
{
	$localidad = str_replace('-',' ',$_POST["localidadid"]);
	echo "<form name='form1' method='post' action='cfarmacias.php'>
			<label>Localidad: 
				<select name='localidadid' id='localidadid'>
					<option value='Todas'>Todas</option>";					
					foreach ($localidades as $row)
					{
						if ($row['Localidad'] == $localidad)
						{
							printf('<option value=%s selected>%s</option>', str_replace(' ','-',$row['Localidad']), $row['Localidad']);
						}
						else
						{
							printf('<option value=%s>%s</option>', str_replace(' ','-',$row['Localidad']), $row['Localidad']);
						}
					}					
	echo '</label>   <input type="submit" name="filtrar" id="filtrar" value="Filtrar"></form><br>';
		
	$listafarmacias = $webservice->farmaciaListarFarmaciasxLocalidad($localidad);
	
	echo '<p><table  border="1"><tr><td>Nombre</td><td>Direccion</td><td>Telefono</td><td>Localidad</td></tr>';
	
	foreach ($listafarmacias as $row)
	{
		printf('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', 
			ucwords($row['Nombre']), 
			ucwords($row['Direccion']), 
			ucwords($row["Telefono"]),
			ucwords($row["Localidad"]));
	}
	echo '</table></p>';
}

?>
  </label>
</form>
<p><br>
</p>
<p><br>
  <!-- End ImageReady Slices -->
  <img src="images/marco-inferior.PNG" width="776" height="74"></p>
</BODY>
</center>
</HTML>